<div id="center_tieude">
    <img src="../../Picture/admin.ico"/>
    <h3>Danh Sách Liên Hệ</h3>        
</div> <!--end id center_tieude-->

<div id="timkiem_them">
<form action="" method="post">
    <select name="timkiem_lienhe">
        <option value="ten">Tìm theo tên</option>
        <option value="yahoo">Tìm theo yahoo</option>
    </select>
    <label style="float:left; margin:10px;">Từ khóa:</label>
    <input style="float:left; margin:10px;" type="search" name="key"/>
    <input style="float:left; margin:10px;" type="submit" name="timkiem" value="Tìm Kiếm"/>
</form>
</div><!--end id timkiem_them-->
<table border="1px" cellspacing="0px" width="700px">
    <tr>
        <th>
            Yahoo
        </th>
        <th>
            Tên người liên hệ
        </th>
        <th colspan="2">
          <a href="admin.php?obj=lienhe&act=ad"><img title="Thêm liên hệ" alt="Thêm liên hệ" src="../../Picture/ad.png"/></a>
      </th>
    </tr>
    
     <?php
	  		if(isset($_GET['trang']))
			{
				$page=$_GET['trang'];
				$arr=lienhe::GetAll($page,9);
				for($i=0;$i<count($arr);$i++)     
				{    
				?>  	
					 <tr>
                            <td>
                                <?php echo $arr[$i]->Yahoo; ?>
                            </td>
                            <td>
                                <?php echo $arr[$i]->TenNguoiLienHe; ?>
                            </td>
                            <td>
                                <a href="admin.php?obj=lienhe&act=update&id=<?php echo $arr[$i]->Yahoo; ?>"><img title="Sửa liên hệ" alt="Sửa liên hệ" src="../../Picture/update.png"/></a>
                            </td>
                            <td>
                                <a href="admin.php?obj=lienhe&act=delete&id=<?php echo $arr[$i]->Yahoo; ?>"><img title="Xóa liên hệ" alt="Xóa liên hệ" src="../../Picture/del.png"/></a>
                            </td>
                        </tr>
     <?php
          		}
			}
			else
			{
				$page=1;
				$arr=lienhe::GetAll($page,9);
				for($i=0;$i<count($arr);$i++)     
				{    
				?>  	
					 <tr>
                        <td>
                            <?php echo $arr[$i]->Yahoo; ?>
                        </td>
                        <td>
                            <?php echo $arr[$i]->TenNguoiLienHe; ?>
                        </td>
                        <td>
                            <a href="admin.php?obj=lienhe&act=update&id=<?php echo $arr[$i]->Yahoo; ?>"><img title="Sửa liên hệ" alt="Sửa liên hệ" src="../../Picture/update.png"/></a>
                        </td>
                        <td>
                            <a href="admin.php?obj=lienhe&act=delete&id=<?php echo $arr[$i]->Yahoo; ?>"><img title="Xóa liên hệ" alt="Xóa liên hệ" src="../../Picture/del.png"/></a>
                        </td>
                    </tr>
     <?php
          		}
			}		
      ?>

</table><!--end class danhmuc-->
<div id="trang">
	<?php
		if(!isset($_GET["trang"]))
			$_GET["trang"]=1;
		if(isset($_GET["obj"])&&$_GET["obj"]=='lienhe')
		{
		$a = lienhe::CountLienHe();
		$sotrang = ceil($a/9);
		$hientai = $_GET["trang"];
			for ($page = 1;(int)$page<=$sotrang;$page++ )
			{
				if($hientai != $page)
				{ echo "
					<a href='admin.php?obj=lienhe&trang=$page'>$page</a>";
				}
				else
				{
					echo "<b>".$page."</b>";
				}
			}
		}
		
?>
</div>
</table><!--end class danhmuc-->